/**
 * 集中处理请求，其实用这个，都可以不用封装apiurl了
 */
import {get, post, patch, put, remove} from '../config/http';
import {API} from '../../public/js/BlogApi';

// 默认导出常量方法，()没有参数，返回 => 的是这个对象，可以对这个对象进行then操作。
export const getArticle = currval => get(API.articleUrl, {currentpage: currval});

// 带参数
export const saveArticle = articleVal => post(API.saveBlogUrl,articleVal);

// 带多个参数
export const testHttp = (val1,val2) => post(API.playUrl,{
    type:1,
    vals1: val1,
    vals2: val2,
});

/**
 * 获取照片
 * @param currval1
 */
export const getPhoto = currval1 => get(API.photoUrl,{currentpage: currval1});

/**
 * 获取分类
 * @param currval
 */
export const getSort = currval => get(API.sortUrl,{currentpage: currval});

/**
 * 获取热点
 * @param currval
 */
export const getHot = currval => get(API.recomUrl,{currentpage: currval});

/**
 * 获取列表
 * @param currval
 */
export const getArticleList = currval => get(API.articleUrl,{currentpage: currval});

/**
 * 获取相册的分享
 * @param currval
 */
export const getPhotoList = currval => get(API.photoUrl,{currentpage:currval});

/**
 * 分类查询
 * @param currval
 * @param id
 */
export const getArticleList_Id = (currval,id) => get(API.sortUrl + "/" + id,{currentpage: currval});

/**
 * 获取文章详情
 * @param val1
 */
export const getArticle_info = val1 => get(API.articleUrl + "/" + val1);

/**
 * 删除文章
 * @param val1
 */
export const deleteArticle_Info = val1 => remove(API.deleteByIdInfo + "/" + val1);
